=== WP List Files === Contributors: raptorNL Tags: files Requires at least: 1.5 Tested up to: 2.5 Stable tag: trunk Walks trought a directory (and its subdirectories if so desired), generates a nested list form it and includes it in a page or a post. == Description == **WP List Files** is a WordPress plugin that walks trough a given directory (and its subdirectories if so desired), generates a nested list form it and includes it in a page or a post. It includes a JavaScript to allow collapsing and expanding of directories. If no JavaScript support is available, it gracefully falls back to fully expanded. Visit the [plugin home page][2] to see it in action. Including `` in a page or post will insert a list of files in **/dir**. `` inserts a list of files in **/dir**, but makes the links point to **/linkto**. * **/dir** and **/linkto** should be relative to your site root, or this won't work. * **/dir** should be a valid directory that's readable by anyone. If you get **Empty** or something like it and you know there are files in the specified directory, check the 2 points mentioned above. [2]: http://helvensteijn.com/wordpress/wp-list-files/ == Installation == I've tested this plugin with WordPress 2.2 - 2.5, but I see no reason why it wouldn't work with any other version from 1.5 and up. To install, upload the **wp-list-files** directory to your **/wp-content/plugins** directory. Then activete it from the **Plugins** panel. In **wp-list-files/wp-list-files.php** are some options you might want to take a look at. == JavaScript == If you want subdirectories to be collapsed on page load, you'll have to make a minor ajustment to your theme, especially **header.php**. You'll have to add **wplfCollapseAll()** to the **body** tag's **onload** attribute, so that it looks something like this: `` Or this: `` == Advanced usage == **/linkto** is useful if you want to play with **.htaccess** and **mod-rewrite** and you want your files to appear "inside" a page. For instance, you use 'nice' permalinks and you have a page **/files/** that lists a buch of files and want those files to be accessible like **/files/image.jpg**. Since the directory "/files/" doesn't really exist (it's a WordPress page, after all), you'll have to put those files somewhere else. In this case, you could insert `` in your post or page, and a rewrite rule in your **.htaccess** that would look something like this: `RewriteRule ^files/(.+)$ /path/to/files/$1 [L]` That would generate a list of all the files in **/path/to/files**, and make the links point to **/files**, so **/path/to/files/image.jpg** would be linked as **/files/image.jpg**. The rewrite rule will then translate that back to **/path/to/files/image.jpg**, and the webserver will serve the user that file. == Version history == * 2.3 (2008-06-22) - JavaScript rewritten again, no more jQuery as it caused too much compatibility problems * 2.2 (2009-10-05) - JavaScript rewritten, now uses jQuery library * 2.1.1 (2007-09-28) - Clearer documentation on how to enable JavaScript, it will now also not work if disabled * 2.1 (2007-09-19) - Fixed a bug where the "expand/collapse all" links wouldn't work in MSIE * 2.0 (2007-09-17) - Refactored the code - Removed some (what I believed to be) superfluous options - Added back alphabetic sorting, directories are always displayed on top - Added an option to include a JavaScript that allows collapsing and expanding of directories * 1.4 (2007-08-23) - Will now also do more than one listing per page/post * 1.3 (2007-08-22) - Put a limit on how deep the recurse can go (defaults to 5 levels) - Added some options to set that limit and to control how the list is generated * 1.2 (2007-08-20) - Will now walk though directories recursively and display them as nested lists (thanks to Guoqiang Shen for the suggestion) - Removed sorting option for now, got too complicated * 1.1 (2007-07-10) - Added option to set whether to sort files alphabetically or leave them in the order presented by the file system * 1.0 (2007-07-03) - Initial release == License == Copyright (c) 2007-2008 Colin Helvensteijn <[helvensteijn.com][1]> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [1]: http://helvensteijn.com/home/